package com.wowangz.cms.dailyoperation.services.service;

import java.util.HashMap;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.wowangz.cms.dailyoperation.services.pojo.Services;
import com.wowangz.cms.syscore.exception.ServiceException;
import com.wowangz.cms.syscore.service.BaseService;

public class ServicesService extends BaseService {

	private Logger logger = LoggerFactory.getLogger(ServicesService.class);
	
	/**
	 * 新增服务信息
	 * @param province
	 * @throws Exception
	 */
	public void addServices(Services services) throws ServiceException {
		this.getSqlSession().insert("Services.insertServices", services);
	}
	
	/**
	 * 分页查询总条数
	 * 
	 * @param map
	 * @return
	 */
	public long findResultCount(HashMap<String, Object> map) throws ServiceException {
		Long countNum = this.getSqlSession().selectOne("Services.queryServicesCount", map);
		return countNum;
	}

	/**
	 * 查询记录集合
	 * 
	 * @param map
	 * @return
	 */
	public List<Services> findResultList(HashMap<String, Object> map) throws ServiceException {
		List<Services> list = this.getSqlSession().selectList("Services.queryServicesPage", map);
		return list;
	}
	
	/**
	 * 验证信息
	 * @param map
	 * @return
	 * @throws Exception
	 */
	public boolean validationServices(HashMap<String, Object> map) throws ServiceException {
		Long countNum = this.getSqlSession().selectOne("Services.validationServices", map);
		if(countNum != 0){
			return false;
		}else{
			return true;
		}
	}
	
	public Services findservicesById(String id) throws ServiceException {
		Services services = this.getSqlSession().selectOne("Services.findservicesById", id);
		return services;
	}
	
	public void update(Services services) throws ServiceException {
		this.getSqlSession().update("Services.updateServices", services);
	}
	
	
	/**
	 * 查询服务是否复核过
	 * 
	 * @param map
	 * @return
	 */
	public long findMenuListByServiceID(HashMap<String, Object> map) throws ServiceException {
		Long countNum = this.getSqlSession().selectOne("Services.findMenuListByServiceID", map);
		return countNum;
	}

}
